package com.woniuxy01;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.Arrays;

/**
 * @author 作者
 * @create 2025-07-28 16:31
 */
public class Test07 {

    public static void main(String[] args) {
//        System.out.println(0.2+0.1);
//        BigDecimal b1 = new BigDecimal("19");
//        BigDecimal b2 = new BigDecimal("7");
        BigDecimal b1 = new BigDecimal("1000000000000000000000000000000000000000000000000000");
        BigDecimal b2 = new BigDecimal("3");
        System.out.println(b1.add(b2));
        System.out.println(b1.subtract(b2));
        System.out.println(b1.multiply(b2));
        System.out.println(b1.divide(b2,5,BigDecimal.ROUND_HALF_UP));
        System.out.println(b1.divide(b2,6,4));
        System.out.println(b1.divide(b2,5,BigDecimal.ROUND_DOWN));
        System.out.println(b1.divide(b2,5,BigDecimal.ROUND_UP));
    }

    private static void test02() {
        BigInteger b1=new BigInteger("999999999999999999999999999999999");
        BigInteger b2=new BigInteger("99999999999999");
        System.out.println(b1.add(b2));
        System.out.println(b1.subtract(b2));
        System.out.println(b1.multiply(b2));
        System.out.println(b1.divide(b2));
        System.out.println(Arrays.toString(b1.divideAndRemainder(b2)));
    }

    private static void test01() {
        long i=Long.MAX_VALUE;
        System.out.println(i);
        i=i+1;
        System.out.println(i);
        System.out.println(Long.MIN_VALUE);
    }
}
